package com.tedu.parkinglot.blakname.controller;

import com.tedu.parkinglot.base.response.JsonResult;
import com.tedu.parkinglot.blakname.pojo.dto.BlackNameParam;
import com.tedu.parkinglot.blakname.pojo.dto.BlackNameQuery;
import com.tedu.parkinglot.blakname.pojo.vo.BlackNameVO;
import com.tedu.parkinglot.blakname.service.BlackNameService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.List;

@RestController
@Slf4j
@RequestMapping("/v1/black")
public class BlackNameController {
    @Autowired
    private BlackNameService blackNameService;

    @GetMapping("select")
    public JsonResult select(BlackNameQuery blackNameQuery){
        log.debug("查询黑名单11:BlackNameQuery:{}", blackNameQuery);
        List<BlackNameVO> list = blackNameService.select(blackNameQuery);
        log.debug("查询黑名单:list:{}", list);
        return JsonResult.ok(list);
    }
    @PostMapping("insert")
    public JsonResult insert(BlackNameParam blackNameParam){
        log.debug("新增黑名单:{}", blackNameParam);
        blackNameService.insert(blackNameParam);
        return JsonResult.ok();
    }
    @PostMapping("update")
    public JsonResult update(BlackNameParam blackNameParam){
        log.debug("更新审批单:{}", blackNameParam);
        blackNameService.update(blackNameParam);
        return JsonResult.ok();
    }
}
